package products;

enum State{NEW, LOADED, CHANGED};

public class Product {
	private String name;
	private String description;
	private double cost;
	private State state = State.NEW;
	
	public Product(String n, String d, double c){
		this.name = n;
		this.description = d;
		this.cost = c;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getCost() {
		return cost;
	}

	public void setCost(double cost) {
		this.cost = cost;
	}
	
	public State getState() {
		return this.state;
	}
	
	public String toString(){
		return "Name: " + name + ", description: " + description + ", cost: " + cost + ", state: " + state;
	}
	
	public ProductMemento memento() {
		return new ProductMemento(name, description, cost, state);
	}
	
	public void restoreMemento(ProductMemento memento) {
		this.name = memento.getName();
		this.description = memento.getDescription();
		this.cost = memento.getCost();
		this.state = memento.getState();
	}
	
}
